package cn.com.aiton.educenter.service.impl;

import cn.com.aiton.educenter.entity.PestsControl;
import cn.com.aiton.educenter.entity.PestsTrap;
import cn.com.aiton.educenter.entity.vo.PestsQrcodeVo;
import cn.com.aiton.educenter.entity.vo.TrapQrcodeVo;
import cn.com.aiton.educenter.mapper.PestsTrapMapper;
import cn.com.aiton.educenter.service.PestsTrapService;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 诱捕器业务数据表 服务实现类
 * </p>
 *
 * @author testAuthor
 * @since 2021-03-11
 */
@Service
public class PestsTrapServiceImpl extends ServiceImpl<PestsTrapMapper, PestsTrap> implements PestsTrapService {
    //查询某一天注册人数
    @Override
    public Integer countDay(String day) {
        return baseMapper.countTrapDay(day);
    }

    @Override
    public Integer countDayByProjectId(String day, String projectId) {
        return baseMapper.countDayByProjectId(day,projectId);
    }

    @Override
    public Integer countDayByProjectIdAndMemberId(String day, String projectId, String memberId) {
        return baseMapper.countDayByProjectIdAndMemberId(day,projectId,memberId);
    }

    @Override
    public IPage<TrapQrcodeVo> pageTrapAndQrcode(Page<TrapQrcodeVo> page, Wrapper wrapper) {
        IPage<TrapQrcodeVo> cc = baseMapper.pageTrapAndQrcode(page,wrapper);
        return cc;
    }

    @Override
    public Integer countTrapByProjectId(String projectId) {
        QueryWrapper<PestsTrap> wrapper = new QueryWrapper<>();
        wrapper.eq("project_id",projectId);
        Integer count = baseMapper.selectCount(wrapper);
        return count;
    }

}
